//
//  Transporter.swift
//  atlantis-iOS
//
//  Created by Nghia Tran on 10/23/20.
//  Copyright © 2020 Proxyman. All rights reserved.
//

import Foundation

//netcrawl是来自Proxyman抓包插件【个人改造，官方pod异常且要求项目支持iOS13以上版本，所以改造此版本提供使用】
//netcrawl源代码来自https://github.com/ProxymanApp/atlantis

#if canImport(Atlantis)
//针对Atlantis 只支持iOS13 进行的配置
public class ValidCraw: NSObject{
    @objc public static func start(){

        // Add to the end of `application(_:didFinishLaunchingWithOptions:)` in AppDelegate.swift or SceneDelegate.swift
        #if DEBUG
        let Ant:AnyClass? = NSClassFromString("Atlantis.Atlantis")
        let selector = NSSelectorFromString("startWithHostName:")
        if let ant = Ant{
            if(ant.responds(to: selector)){
                ant.perform(selector, with: nil, afterDelay: 0)
            }
        }
        #endif

       
    }
}
public typealias Craw = ValidCraw
#else
public class EmptyCraw{
    static func start(){
        #if DEBUG
            Atlantis.start()
        #endif
    }
}
public typealias Craw = EmptyCraw
#endif


@objc public class NetCrawl:NSObject{
    @objc public static func start(){
        Craw.start()
        
//        Atlantis.start()
    }
}
    
